<html>
<head><meta charset="utf-8"><title>LLVM noalias docs update · t-lang/wg-unsafe-code-guidelines · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/index.html">t-lang/wg-unsafe-code-guidelines</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/LLVM.20noalias.20docs.20update.html">LLVM noalias docs update</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="189131311"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/LLVM%20noalias%20docs%20update/near/189131311" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/LLVM.20noalias.20docs.20update.html#189131311">(Feb 26 2020 at 16:34)</a>:</h4>
<p>I just saw this: <a href="https://reviews.llvm.org/D74935" target="_blank" title="https://reviews.llvm.org/D74935">https://reviews.llvm.org/D74935</a><br>
If I read it correct this is fine for us (it is, in fact, how we interpreted <code>noalias</code> all along for shared references), but more eyes can't hurt. ;)<br>
Also I am surprised they say this matches C; it's news to me that C <code>restrict</code> permits read-read aliasing. I'll have to dig out the relevant part of the standard again.</p>



<a name="189135737"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/LLVM%20noalias%20docs%20update/near/189135737" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/LLVM.20noalias.20docs.20update.html#189135737">(Feb 26 2020 at 17:21)</a>:</h4>
<p>I haven't thought as deeply about it but yes, my impression when I read it was also that this change blesses the way we've always used noalias for shared references (absent UnsafeCell)</p>



<a name="189181005"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/LLVM%20noalias%20docs%20update/near/189181005" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/LLVM.20noalias.20docs.20update.html#189181005">(Feb 27 2020 at 02:09)</a>:</h4>
<p>I think our interpretation was already justified this way:</p>
<blockquote>
<p>For further details, please see the discussion of the NoAlias response in alias analysis.</p>
</blockquote>
<p>which gives an example:</p>
<blockquote>
<p>when the two pointers are only ever used for reading memory.</p>
</blockquote>



<a name="189196390"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/LLVM%20noalias%20docs%20update/near/189196390" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/LLVM.20noalias.20docs.20update.html#189196390">(Feb 27 2020 at 08:59)</a>:</h4>
<p>re: C's <code>restrict</code>, indeed <a href="http://port70.net/~nsz/c/c11/n1570.html#6.7.3.1" target="_blank" title="http://port70.net/~nsz/c/c11/n1570.html#6.7.3.1">the standard says</a></p>
<blockquote>
<p>If L is used to access the value of the object X that it designates, and X is also modified (by any means), then</p>
</blockquote>
<p>Good to know, I wasn't aware read-only aliasing was allowed for <code>restrict</code>.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>